listbase: Allocate gridview items properly on RTL
authorBenjamin Otte <otte@redhat.com>
Wed, 24 Jun 2020 03:42:38 +0000 (05:42 +0200)
committerBenjamin Otte <otte@redhat.com>
Fri, 26 Jun 2020 05:13:32 +0000 (07:13 +0200)
We need to flip the items.

gtk/gtklistbase.c

index 2568b0604ed47d590b49ed20743d8cbf45f17169..05df60b30f47cacc3004605aa4f2de6b83de2b6f 100644 (file)
@@ -1334,7 +1334,7 @@ update_autoscroll (GtkListBase *self,
 /**
  * gtk_list_base_size_allocate_child:
  * @self: The listbase
- * @child: 
+ * @child: The child
  * @x: top left coordinate in the across direction
  * @y: top right coordinate in the along direction
  * @width: size in the across direction
@@ -1356,26 +1356,41 @@ gtk_list_base_size_allocate_child (GtkListBase *self,
 
   if (gtk_list_base_get_orientation (GTK_LIST_BASE (self)) == GTK_ORIENTATION_VERTICAL)
     {
-      child_allocation.x = x;
-      child_allocation.y = y;
-      child_allocation.width = width;
-      child_allocation.height = height;
-    }
-  else if (_gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR)
-    {
-      child_allocation.x = y;
-      child_allocation.y = x;
-      child_allocation.width = height;
-      child_allocation.height = width;
+      if (_gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR)
+        {
+          child_allocation.x = x;
+          child_allocation.y = y;
+          child_allocation.width = width;
+          child_allocation.height = height;
+        }
+      else
+        {
+          int mirror_point = gtk_widget_get_width (GTK_WIDGET (self));
+
+          child_allocation.x = mirror_point - x - width;
+          child_allocation.y = y;
+          child_allocation.width = width;
+          child_allocation.height = height;
+        }
     }
   else
     {
-      int mirror_point = gtk_widget_get_width (GTK_WIDGET (self));
+      if (_gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR)
+        {
+          child_allocation.x = y;
+          child_allocation.y = x;
+          child_allocation.width = height;
+          child_allocation.height = width;
+        }
+      else
+        {
+          int mirror_point = gtk_widget_get_width (GTK_WIDGET (self));
 
-      child_allocation.x = mirror_point - y - height; 
-      child_allocation.y = x;
-      child_allocation.width = height;
-      child_allocation.height = width;
+          child_allocation.x = mirror_point - y - height;
+          child_allocation.y = x;
+          child_allocation.width = height;
+          child_allocation.height = width;
+        }
     }
 
   gtk_widget_size_allocate (child, &child_allocation, -1);